package com.ssi.core.framework.page.impl;

import com.ssi.core.config.ConfigHolder;
import com.ssi.core.framework.page.PageModel;


public class PageModelImpl implements PageModel {

	private static final long serialVersionUID = 6058623216294866584L;

	/**
	 *  总记录数
	 */
	private int totalRecords = 0;

	/**
	 * 总页数
	 */
	private int totalPage = 0;

	/**
	 * 当前页号
	 */
	private int currentPage = 1;

	/**
	 * 是第一页吗
	 */
	private boolean isFristPage = true;

	/**
	 * 是最后一页吗
	 */
	private boolean isLastPage = false;
	
	
	/**
	 * 每页的记录个数
	 */
	private int pageSize = ConfigHolder.getPageSize();

	/**
	 * 当前页的起始记录数
	 */
	private int startRowPosition = 0;

	/**
	 * 当前页的最后记录数
	 */
	private int endRowPosition = 0;

	/**
	 * 最大限记录数
	 */
	private int maxRecords = ConfigHolder.getMaxRecords();

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getEndRowPosition() {
		return endRowPosition;
	}

	public void setEndRowPosition(int endRowPosition) {
		this.endRowPosition = endRowPosition;
	}

	public boolean getIsFristPage() {
		return isFristPage;
	}

	public void setIsFristPage(boolean isFristPage) {
		this.isFristPage = isFristPage;
	}

	public boolean getIsLastPage() {
		return isLastPage;
	}

	public void setIsLastPage(boolean isLastPage) {
		this.isLastPage = isLastPage;
	}

	public int getPageSize() {
		if (this.pageSize==0){
			this.pageSize= ConfigHolder.getPageSize();
		}
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getStartRowPosition() {
		return startRowPosition;
	}

	public void setStartRowPosition(int startRowPosition) {
		this.startRowPosition = startRowPosition;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	public int getMaxRecords() {
		return maxRecords;
	}

	public void setMaxRecords(int maxRecords) {
		this.maxRecords = maxRecords;
	}


}
